import React, { Component } from 'react';
import { connect } from 'react-redux';

import {changeValueAction} from './actions/counterAction'

class content extends Component {
    clickchange(value) {
        // alert('value: ' + value);
        console.log('value: ' + value);
    }

    render() {
        const {
            currentValue,
            changeValueAction
        } = this.props;

        return (
            <div class="">
                <h1>{ JSON.stringify(this.props) }</h1>

                 <button onClick={ changeValueAction.bind(this, 1) }>
                    加法
                </button>
                <button onClick={ changeValueAction.bind(this, -1) }>
                    减法
                </button>

                <h1>Count: {this.props.currentValue}</h1>
            </div>
        );
    }
}

function mapStateToProps(state) {
	return state;
}

export default connect(mapStateToProps, {changeValueAction})(content);
